﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CH04_02
{
    public class clsStudent
    {
        // 公有属性和私有属性;
        public string strName;
        private int iAge;

        // 公有方法;
        public void SetAge(int _iAge)
        {
            this.iAge = _iAge;
        }

        public int GetAge()
        {
            return this.iAge;
        }
    }
    class Class1
    {
        static void Main(string[] args)
        {
            clsStudent s = new clsStudent();
            s.SetAge(20);                       // 赋值年龄;                
            Console.WriteLine(s.GetAge());      // 获取年龄;
        }
    }  
}
